//获取Oracle数据库所在的服务器IP
var strss = document.getElementById("serverIp").value;
var code = document.getElementById("serverCode").value;
var strs = new Array();
strs = strss.split(",");
//strss = '10.10.200.226,10.10.200.228';
//勾画整体布局
var left_1 = document.getElementById("left_1");
var left_2 = document.getElementById("left_2");
var left_3 = document.getElementById("left_3");

document.getElementById('right').innerHTML = '<div id="right_1" style="border-style: solid; border-width: 32px 37px; border-image-slice: 32 37 fill; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; background: none;border-image-source:url(\'image/kuang.png\');height: 305px"></div><div style="height: 20px"></div><div id="right_2" style="border-style: solid; border-width: 16px 18px; border-image-slice: 32 37 fill; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; background: none;border-image-source:url(\'image/kuang.png\');height: 312px"></div><div style="height: 20px"></div><div id="right_3" style="border-style: solid; border-width: 16px 18px; border-image-slice: 32 37 fill; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; background: none;border-image-source:url(\'image/kuang.png\');height: 305px"></div>';
var right_1 = document.getElementById("right_1");
var right_2 = document.getElementById("right_2");
var right_3 = document.getElementById("right_3");

document.getElementById('center').innerHTML = '<div id="center_1" style="height: 657px"><div><div id="center_2" style="border-style: solid; border-width: 32px 37px; border-image-slice: 32 37 fill; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; background: none;border-image-source:url(\'image/kuang.png\');height: 305px;position:absolute;top:657px;width:862px"></div>';
var center_1 = document.getElementById("center_1");
var center_2 = document.getElementById("center_2");
//勾画中二区域


//勾画左一区域
left_1.innerHTML = '<h4 align="center" style="color:#EBD775">CPU信息</h4>';
getCanvas('cpuUse', left_1);
getCpuEcharts();
getCpuInfoList();
setInterval(function() {
	getCpuInfo();
}, 15000);

//勾画左二区域 
left_2.innerHTML = '<h4 align="center" style="color:#EBD775">内存信息</h4>';
getCanvas('memUse', left_2);
getMemEcharts();
getMemInfoList();
setInterval(function() {
	getmemInfo();
}, 15000);

//勾画左三区域 
left_3.innerHTML = '<h4 align="center" style="color:#EBD775">磁盘信息</h4>';
getCanvas('diskUse', left_3);
getDiskEcharts();
getDIskInfo();
setInterval(function() {
	option_left3.yAxis[0].data.length=0;
	option_left3.series.length = 0;
	getDIskInfo();
}, 15000);

//勾画右一区域
right_1.innerHTML = '<h4 align="center" style="color:#EBD775">ORACLE状态信息</h4>';
getORacleStatusCanvas('serverAndPort', right_1);
getTableCanvas('oracleStatus',right_1)
getTable(oracleStatus);

//勾画右二区域
right_2.innerHTML = '<h4 align="center" style="color:#EBD775;margin-top: 5.5%">ORACLE数据库TMPFS状态</h4>';
getCanvas('tmpfsStatus', right_2);
getTmpfsEcharts();


//勾画右三区域
right_3.innerHTML = '<h4 align="center" style="color:#EBD775;margin-top: 5.5%">ORACLE连接数</h4>';
getCanvas('oracleConn', right_3);
getOracleConnChartEcharts();
getOracleInfo();
setInterval(function() {
	freshOracleInfo();
}, 15000);

//函数启动 中一区域
getCanvas('topological', center_1);
getDIskInfoStart();
setInterval(function() {
	freshDIskInfo();
}, 15000);

//勾画中二区域
center_2.innerHTML = '<h4 align="center" style="color:#EBD775;margin-top: 1%" id="oracleTable">ORACLE表空间使用率</h4>';
getCanvas('tableUser', center_2);
getTableUserEcharts();
gettableUserData();
setInterval(function() {
	gettableUserData();
}, 15000);
//得到表空间使用率图表
function getTableUserEcharts() {
	right3Chart = echarts.init(tableUser);
	option_right3 = {
		color: ['#277ACE'], //可选色：'#86D560', '#AF89D6', '#59ADF3', '#FF999A',
		// '#FFCC67'
		tooltip : {
			trigger : 'axis',
			axisPointer : { // 坐标轴指示器，坐标轴触发有效
				type : 'shadow' // 默认为直线，可选为：'line' | 'shadow'
			}
		},
		grid : {
			left : '0%',
			top : '3%',
			right : '10%',
			bottom : '37%',
			containLabel : true
		},
	    legend: {
	    	data:[],
	        itemWidth:11,
	        itemHeight:10,
			textStyle:{
				color:'#eee',
				fontSize:10,
			},
			top:'93%'
	    },
		xAxis : [ {
			type : 'category',
			data : [],
			splitLine : {
				"show" : false
			},
			axisTick : {
				"show" : false
			},
			splitArea : {
				"show" : false
			},
			axisLabel : {
				interval : 0,
				rotate : -70,
				align : 'left',
				show : true,
				splitNumber : 15,
				textStyle : {
					fontFamily : "微软雅黑",
					fontSize : 10,
					color : '#EEE',
				}
			},
		} ],
		yAxis : [ {
			type : 'value',
			min : 0,
			max : 100,
			splitLine : {
				lineStyle : {
					color : '#284190'
				}
			//show:false
			},
			axisLabel : {
				formatter : '{value}%',
				textStyle : {
					fontSize : 10,
					color : '#EEE',
				}
			},
		} ],
		series : [{
			name : '表空间使用率',
			type : 'bar',
			barWidth : '33%',
			barGap:0,
			data : [],
			itemStyle:{
				normal:{
					barBorderRadius: 50,
				}	
			},
			label : {
				normal : {
					show : false,
					formatter : '{c}%',
					position : 'top',
					textStyle : {
						fontSize : 10
					}
				}
			},
		},]
	};
}
//得到表空间使用率数据
function gettableUserData() {
	$.post('OracleInfo/getOracleTableUserInfo',{},function(data){
		var data = data.data;
		for ( var key in data) {
			option_right3.xAxis[0].data.push(key);
			if(data[key]>parseInt(oracletablespaceused)){
				option_right3.series[0].data.push({
					value : data[key],
					itemStyle : {
						normal : {
							color : '#c23531'
						}
					}
				});
				var hour = new Date().getHours();
				var minute = new Date().getMinutes();
				var second = new Date().getSeconds();
				prompt([hour,minute,second].join(':')+'&nbsp; '+ key+'&nbsp;的表空间使用率已达到&nbsp;'+data[key]);
				warnMusic();
//				warnning+=key+'的表空间使用率已达到'+data[key]+' ';
			}else {
				option_right3.series[0].data.push({
					value : data[key],
					itemStyle : {
						normal : {
							color : '#277ACE'
						}
					}
				});
			}
		}
		right3Chart.setOption(option_right3);
	});
	option_right3.xAxis[0].data.length=0;
	option_right3.series[0].data.length=0;
}

//得到cpu的echarts图表
function getCpuEcharts() {
	left1Chart = echarts.init(cpuUse);
	option_cpuStatus = {
			color: ['red','gold'],
		    tooltip: {
		        trigger: 'axis',
		        axisPointer: {
		            type: 'cross',
	                label: {
	                    backgroundColor: '#283b56'
	                }
	            },
	            position:function(p){   //其中p为当前鼠标的位置
		            return [p[0] + 10, p[1] - 10];
				}
		    },
		    grid: {
		    	left: '15px',
	            right: '5%',
	            top: '13%',
	            bottom: '10%',
		        containLabel: true
		    },
		    legend: {
		        data: cGetLegend(),
		        itemWidth:11,
		        itemHeight:10,
				textStyle:{
					color:'#eee',
					fontSize:10,
				},
				top:'91%'
		    },
		    xAxis:  {
		        type: 'category',
		        boundaryGap: true,
		        nameGap:1,
		        data: [],
		        axisTick: {
		        	length:2
		        },
		        axisLine:{
                    lineStyle:{
                        color:'#eee',
                    }
                },
		        axisLabel:{
		        	interval : 0,
					rotate : -33,
					margin : 26,
					align : 'center',
		        	textStyle:{
		        		fontSize:10
		        	}
		        }
		    },
		    yAxis: {
		        type: 'value',
		        min:0,
		        max:100,
		        name:'占用率(%)',
		        axisTick: {
		            show: false
		        },
		        axisLine:{
                    lineStyle:{
                        color:'#eee',
                    }
                }, 
		        axisLabel: {
		            formatter: '{value}%',
		        	textStyle:{
		        		fontSize:10
		        	}
		        }
		    },
		    series: cGetSeries()
		};
}

//得到cpu数据
function getCpuInfoList() {
	for (var i = 0; i < strs.length; i++) {
		if(i == 0){
			$.post('cpuInfo/getCpuinfoList',{ip:strs[i]},function(data){
				var data = data.data;
				for (var j = 0; j < data.length; j++) {			
					var used = data[j].used;
					if(used>parseInt(cpuUsed)){
						prompt(strs[i]+ '&nbsp; CPU使用率已达到 &nbsp;' +used+'%');
						warnMusic();
					};
					var time = data[j].time;
					var hour = new Date(time*1000).getHours();
					if(hour < 10){
						hour='0'+hour;
					}
					var minute = new Date(time*1000).getMinutes();
					if(minute < 10){
						minute='0'+minute;
					}
					var second = new Date(time*1000).getSeconds();
					if(second < 10){
						second='0'+second;
					}
						option_cpuStatus.series[0].data.push(used);
						option_cpuStatus.xAxis.data.push([hour,minute,second].join(':'));
				}
				left1Chart.setOption(option_cpuStatus);
			});
		}else {
			$.post('cpuInfo/getCpuinfoList',{ip:strs[i]},function(data){
				var data = data.data;
				for (var j = 1; j < strs.length; j++) {
					if(data[0].ip == strs[j]){
						for (var m = 0; m < data.length; m++) {			
							var used = data[m].used;
							if(used>parseInt(cpuUsed)){
								prompt(strs[j]+ '&nbsp; CPU使用率已达到&nbsp; ' +used+'%');
								warnMusic();
							};
							option_cpuStatus.series[j].data.push(used);
						}			
					}
				}
				left1Chart.setOption(option_cpuStatus);
			});
		}
	}
}

function getCpuInfo() {
	for (var i = 0; i < strs.length; i++) {
		if(i == 0){
			$.post('cpuInfo/getNewCpuinfo',{ip:strs[i]},function(data){
				var data = data.data;
				var used = data.used;
				if(used>parseInt(cpuUsed)){
					prompt(strs[i]+ '&nbsp; CPU使用率已达到&nbsp; ' +used+'%');
					warnMusic();
				};
				var time = data.time;
				var hour = new Date(time*1000).getHours();
				if(hour < 10){
					hour='0'+hour;
				}
				var minute = new Date(time*1000).getMinutes();
				if(minute < 10){
					minute='0'+minute;
				}
				var second = new Date(time*1000).getSeconds();
				if(second < 10){
					second='0'+second;
				}
				if(option_cpuStatus.series[0].data.length<20){
					option_cpuStatus.series[0].data.push(used);
					option_cpuStatus.xAxis.data.push([hour,minute,second].join(':'));
				}else {
					option_cpuStatus.series[0].data.shift();
					option_cpuStatus.series[0].data.push(used);
					option_cpuStatus.xAxis.data.shift();
					option_cpuStatus.xAxis.data.push([hour,minute,second].join(':'));
				}
			});
		}else {
			$.post('cpuInfo/getNewCpuinfo',{ip:strs[i]},function(data){
				var data = data.data;
				for (var j = 1; j < strs.length; j++) {
					var used = data.used;
					if(used>parseInt(cpuUsed)){
						prompt(strs[j]+ '&nbsp; CPU使用率已达到&nbsp; ' +used+'%');
						warnMusic();
					};
					if(data.ip = strs[j]){
						if(option_cpuStatus.series[j].data.length<20){
							option_cpuStatus.series[j].data.push(used);
						}else {
							option_cpuStatus.series[j].data.shift();
							option_cpuStatus.series[j].data.push(used);
						}		
					}
				}
				left1Chart.setOption(option_cpuStatus);
			});
		}
	}	
}

//得到内存的echarts图表
function getMemEcharts() {
	left2Chart = echarts.init(memUse);
	option_memStatus = {
			color: ['red','gold'],
		    tooltip: {
		        trigger: 'axis',
		        axisPointer: {
		            type: 'cross',
	                label: {
	                    backgroundColor: '#283b56'
	                }
	            },
	            position:function(p){   //其中p为当前鼠标的位置
		            return [p[0] + 10, p[1] - 10];
				}
		    },
		    grid: {
		    	left: '15px',
	            right: '5%',
	            top: '13%',
	            bottom: '8%',
		        containLabel: true
		    },
		    legend: {
		    	data: mGetLegend(),
		    	itemWidth:11,
		        itemHeight:10,
				textStyle:{
					color:'#eee',
					fontSize:10,
				},
				top:'93%'
		    },
		    xAxis:  {
		        type: 'category',
		        boundaryGap: false,
		        nameGap:1,
		        data: [],
		        axisTick: {
		        	length:2
		        },
		        axisLine:{
                    lineStyle:{
                        color:'#eee',
                    }
                },
		        axisLabel:{
		        	interval : 0,
					rotate : -33,
					margin : 26,
					align : 'center',
		        	textStyle:{
		        		fontSize:10
		        	}
		        }
		    },
		    yAxis: {
		        type: 'value',
		        min:0,
		        max:100,
		        axisTick: {
		            show: false
		        },
		        name:'占用率(%)',
		        axisLine:{
                    lineStyle:{
                        color:'#eee',
                    }
                },
		        axisLabel: {
		        	formatter: '{value}%',
		        	textStyle:{
		        		fontSize:10
		        	}
		        }
		    },
		    series: mGetSeries()
		};
}

//得到内存的数据
function getMemInfoList() {
	for (var i = 0; i < strs.length; i++) {
		if(i == 0){
			$.post('MemInfo/getMemInfoList',{ip:strs[0]},function(data){
				var data = data.data;
				for (var j = 0; j < data.length; j++) {
					var memUsed = data[j].memUsed;
					if(memUsed>parseInt(memUsedTh)){
						prompt(strs[0]+ ' &nbsp;内存使用率已达到&nbsp; ' +memUsed+'%');
						warnMusic();
					};
					var time = data[j].time;
					var hour = new Date(time*1000).getHours();
					if(hour < 10){
						hour='0'+hour;
					}
					var minute = new Date(time*1000).getMinutes();
					if(minute < 10){
						minute='0'+minute;
					}
					var second = new Date(time*1000).getSeconds();
					if(second < 10){
						second='0'+second;
					}
					option_memStatus.series[0].data.push(memUsed);
					option_memStatus.xAxis.data.push([hour,minute,second].join(':'));
				}
				left2Chart.setOption(option_memStatus);
			});
		}else {
			$.post('MemInfo/getMemInfoList',{ip:strs[i]},function(data){
				var data = data.data;
				for (var j = 1; j < strs.length; j++) {
					if(data[0].ip == strs[j]){
						for (var m = 0; m < data.length; m++) {			
							var memUsed = data[m].memUsed;
							if(memUsed>parseInt(memUsedTh)){
								prompt(strs[j]+ ' &nbsp;内存使用率已达到&nbsp; ' +memUsed+'%');
								warnMusic();
							};
							option_memStatus.series[j].data.push(memUsed);
						}			
					}
				}
				left2Chart.setOption(option_memStatus);
			});
		}
	}
}

function getmemInfo() {
	for (var i = 0; i < strs.length; i++) {
		if(i == 0){
			$.post('MemInfo/getMeminfo',{ip:strs[i]},function(data){
				var data = data.data;
				var memUsed = data.memUsed;
				if(memUsed>parseInt(memUsedTh)){
					prompt(strs[i]+ '&nbsp; 内存使用率已达到 &nbsp;' +memUsed+'%');
					warnMusic();
				};
				var time = data.time;
				var hour = new Date(time*1000).getHours();
				if(hour < 10){
					hour='0'+hour;
				}
				var minute = new Date(time*1000).getMinutes();
				if(minute < 10){
					minute='0'+minute;
				}
				var second = new Date(time*1000).getSeconds();
				if(second < 10){
					second='0'+second;
				}
				if(option_memStatus.series[0].data.length<20){
					option_memStatus.series[0].data.push(memUsed);
					option_memStatus.xAxis.data.push([hour,minute,second].join(':'));
				}else {
					option_memStatus.series[0].data.shift();
					option_memStatus.series[0].data.push(memUsed);
					option_memStatus.xAxis.data.shift();
					option_memStatus.xAxis.data.push([hour,minute,second].join(':'));
				}
			});
		}else {
			$.post('MemInfo/getMeminfo',{ip:strs[i]},function(data){
				var data = data.data;
				for (var j = 1; j < strs.length; j++) {
					var memUsed = data.memUsed;
					if(memUsed>parseInt(memUsedTh)){
						prompt(strs[j]+ '&nbsp; 内存使用率已达到&nbsp; ' +memUsed+'%');
						warnMusic();
					};
					if(data.ip = strs[j]){
						if(option_cpuStatus.series[j].data.length<20){
							option_memStatus.series[j].data.push(memUsed);
						}else {
							option_memStatus.series[j].data.shift();
							option_memStatus.series[j].data.push(memUsed);
						}		
					}
				}
				left2Chart.setOption(option_memStatus);
			});
		}
		
	}	
}

function getDiskEcharts() {
	left3Chart = echarts.init(diskUse);
	option_left3 = {
		color: ['#277ACE','#65f5f3'], //可选色：'#86D560', '#AF89D6', '#59ADF3', '#FF999A',
		// '#FFCC67'
		tooltip : {
			trigger : 'axis',
			axisPointer : { // 坐标轴指示器，坐标轴触发有效
				type : 'shadow' // 默认为直线，可选为：'line' | 'shadow'
			}
		},
		grid : {
			left : '-10%',
			top : '0%',
			right : '16%',
			bottom : '10%',
			containLabel : true
		},
	    legend: {
	    	data:[],
	        itemWidth:11,
	        itemHeight:10,
			textStyle:{
				color:'#eee',
				fontSize:10,
			},
			top:'93%'
	    },
	    xAxis : [ {
	    	type : 'value',
	    	name:'占用率(%)',
	        axisLine:{
                lineStyle:{
                    color:'#eee',
                }
            },
	    	min : 0,
	    	max :100,
	    	splitLine : {
	    		lineStyle : {
	    			color : '#284190'
	    		}
	    //show:false
	    	},
	    	axisLabel : {
	    		formatter : '{value}%',
	    		textStyle : {
	    			fontSize : 10,
	    			color : '#EEE',
	    		}
	    	},
	    } ],
		yAxis : [ {
			type : 'category',
			data : [],
			splitLine : {
				"show" : false
			},
			axisTick : {
				"show" : false
			},
			splitArea : {
				"show" : false
			},
			axisLabel : {
				interval : 0,
				rotate : 0,
				margin : 40,
				align : 'center',
				show : true,
				splitNumber : 15,
				textStyle : {
					fontFamily : "微软雅黑",
					fontSize : 10,
					color : '#EEE',
				}
			},
		} ],
		series : []
	};
}

//得到 磁盘数据
function getDIskInfo() {
	$.post('diskInfo/getDiskinfo', {ip:strss}, function(data) {
		var data = data.data;
		keys = [];
		for ( var key1 in data) {
			option_left3.yAxis[0].data.push(key1);
			var diskInfo = data[key1];
			for ( var key2 in diskInfo) {
				if (diskInfo[key2].diskUsedPer>parseInt(diskUsed)) {
					if($.inArray(key2, keys)==-1){
						keys.push(key2);
						option_left3.legend.data.push(key2+'分区');
						option_left3.series.push({
							name : key2+'分区',
							type : 'bar',
							barWidth : '30%',
							barGap:0,
							data : [{
									value : diskInfo[key2].diskUsedPer,
									itemStyle : {
										normal : {
											color : '#c23531'
										}
									}
									}],
							label : {
								normal : {
									show : true,
									formatter : '{c}%',
									position: 'right',
									textStyle : {
										fontSize : 10
									}
								}
							},
						});
					}else {
						option_left3.series[$.inArray(key2, keys)].data.push(
								{
									value : diskInfo[key2].diskUsedPer,
									itemStyle : {
										normal : {
											color : '#c23531'
										}
									}
								
								});
					}
					prompt(key1+ ' &nbsp;服务器的'+ '磁盘&nbsp;' + key2+'&nbsp;分区的使用率已达到&nbsp; ' +diskInfo[key2].diskUsedPer+'%');
					warnMusic();
//					warnning+=key1+ '服务器的'+ '磁盘' + key2+'分区的使用率已达到' +diskInfo[key2].diskUsedPer+'%'+' ';
				}else {	
					if($.inArray(key2, keys)==-1){
						keys.push(key2);
						option_left3.legend.data.push(key2+'分区');
						option_left3.series.push({
							name : key2+'分区',
							type : 'bar',
							barWidth : '30%',
							barGap:0,
							data : [{
								value : diskInfo[key2].diskUsedPer,
								itemStyle : {
									normal : {
										color : option_left3.color[$.inArray(key2, keys)]
									}
								}
							
							}],
							label : {
								normal : {
									show : true,
									formatter : '{c}%',
									position: 'right',
									textStyle : {
										fontSize : 10
									}
								}
							},
						});
					}else {
						option_left3.series[$.inArray(key2, keys)].data.push(
								{
									value : diskInfo[key2].diskUsedPer,
									itemStyle : {
										normal : {
											color : option_left3.color[$.inArray(key2, keys)]
										}
									}
								
								});
					}
				}
			}
		}
		left3Chart.setOption(option_left3);
	});
}


//得到Legend
function cGetLegend(){
	var data = [];
	for (var i = 0; i < strs.length; i++) {
		var item = strs[i];
		data.push(item);
	}
	return data;
}

function mGetLegend(){
	var data = [];
	for (var i = 0; i < strs.length; i++) {
		var item = strs[i];
		data.push(item);
	}
	return data;
}

//得到Series
function cGetSeries(){
	var serie = [];
	for (var i = 0; i < strs.length; i++) {
		var item = {
			name:strs[i],
			type: 'line',
			data:[]
		}
		serie.push(item);
	}
	return serie;
}

function mGetSeries(){
	var serie = [];
	for (var i = 0; i < strs.length; i++) {
		var item = {
			name:strs[i],
			type: 'line',
			data:[]
		}
		serie.push(item);
	}
	return serie;
}

//oracleConn状态
var oracleConnChart = echarts.init(document.getElementById('oracleConn'));

function getOracleConnChartEcharts() {
	option_oracleConnChart = {
			color: ['#277ACE','#65f5f3'],
			tooltip: {
				trigger: 'axis'
			},
			grid: {
				top : '10%',
				left: '4%',
				right : '8%',
				bottom: '20%',
				containLabel: true,
			},
			legend: {
				top:'5%',
				left:'30%',
				itemWidth: 14,
				itemHeight: 5,
				itemGap: 0,
				data: ['并发连接数','活跃连接数'],
				textStyle:{
					color:'#eee',
					fontSize:10,
				},
				top:'80%'
			},
		    xAxis : 
				        {
				            type : 'category',
				            boundaryGap : false,
				            data : [],
				            axisLabel: {
				            	clickable:true,
					            inside: false,
					            rotate:0,
					            textStyle: {
					                color: '#EEE',
					                fontSize:12
					            }
					        },
					        axisLine: {
				                show: true,
				                lineStyle:{
				                    color:'#EEE',
						    fontSize:14
				                }
				            },
				        }
				    ,
				    yAxis : 
				        {
				            type : 'value',
				            axisLabel: {
				            	formatter : '{value}',
					            textStyle: {
					                color: '#EEE',
					                fontSize:12
					            }
					        },
					        axisLine: {
				                show: true,
				                lineStyle:{
				                    color:'#EEE',
						    fontSize:14
				                }
				            },
				        }
				    ,
			series: [{
				name:'并发连接数',
				type: 'line',
				data:[]
			},
			{
				name:'活跃连接数',
				type: 'line',
				data:[]
			}
			]
	};
}
//oracle tmpfs状态
var tmpfsStatusChart = echarts.init(document.getElementById('tmpfsStatus'));

function tGetSeries(){
	var serie = [];
	for (var i = 0; i < strs.length; i++) {
		var item = {
			name:strs[i],
			type: 'line',
			data:[]
		}
		serie.push(item);
	}
	return serie;
}
function tGetLegend(){
	var data = [];
	for (var i = 0; i < strs.length; i++) {
		var item = strs[i];
		data.push(item);
	}
	return data;
}
function getTmpfsEcharts() {
	option_tmpfsStatus = {
			color: ['#277ACE','#65f5f3'],
			tooltip: {
				trigger: 'axis'
			},
			grid: {
				top : '10%',
				left: '4%',
				right : '8%',
				bottom: '20%',
				containLabel: true,
			},
			legend: {
				top:'5%',
				left:'30%',
				itemWidth: 14,
				itemHeight: 5,
				itemGap: 0,
				data: tGetLegend(),
				textStyle:{
					color:'#eee',
					fontSize:10,
				},
				top:'82%'
			},
		    xAxis : 
				        {
				            type : 'category',
				            boundaryGap : false,
				            data : [],
				            axisLabel: {
				            	clickable:true,
					            inside: false,
					            rotate:0,
					            textStyle: {
					                color: '#EEE',
					                fontSize:12
					            }
					        },
					        axisLine: {
				                show: true,
				                lineStyle:{
				                    color:'#EEE',
						    fontSize:14
				                }
				            },
				        }
				    ,
				    yAxis : 
				        {
				    		min:0,
				    		max:100,
				            type : 'value',
				            axisLabel: {
				            	formatter : '{value}%',
					            textStyle: {
					                color: '#EEE',
					                fontSize:12
					            }
					        },
					        axisLine: {
				                show: true,
				                lineStyle:{
				                    color:'#EEE',
						    fontSize:14
				                }
				            },
				        }
				    ,
			series: tGetSeries()
	};
}
function getOracleInfo() {
	$.post('OracleInfo/getAllOracleInfoList',{ip:strss},function(data){
		var data=data.data;
		var maxTime = data[strs[0]][data[strs[0]].length-1].time;
		for (var int = 1; int < strs.length; int++) {
			var time = data[strs[int]][data[strs[int]].length-1].time.time;
			if(maxTime<time){
				maxTime=time;
			}
		}
		var m=1;
		for ( var key in data) {
			if(data[key][[data[key].length-1]].time==maxTime){
				if(m==1){
					var serviceStatus = data[key][data[key].length-1].status;
					var oracleStatusstr = '服务状态：';
					if(serviceStatus.toLocaleLowerCase()==service){
						oracleStatusstr+='<font color="red">' + serviceStatus + '</font>\t';
						prompt([hour,minute,second].join(':')+'&nbsp; ORACLE服务未开启');
						warnMusic();
					}else {
						oracleStatusstr+='<font color="white">' + serviceStatus + '</font>\t';
					}
					for ( var key1 in data[key][data[key].length-1].portStatus) {
						if(data[key][data[key].length-1].portStatus[key1]==portStatusth){
							oracleStatusstr+='端口' +key1 + '：'+'<font color="red">' + data[key][data[key].length-1].portStatus[key1] + '</font>\t';
						}else {
							oracleStatusstr+='端口' +key1 + '：'+'<font color="white">' + data[key][data[key].length-1].portStatus[key1] + '</font>\t';
						}
					}
					serverAndPort.innerHTML=oracleStatusstr;
					for (var i = 0; i < data[key].length; i++) {
						var time = data[key][i].time;
						var hour = new Date(time*1000).getHours();
						if(hour < 10){
							hour='0'+hour;
						}
						var minute = new Date(time*1000).getMinutes();
						if(minute < 10){
							minute='0'+minute;
						}
						var second = new Date(time*1000).getSeconds();
						if(second < 10){
							second='0'+second;
						}
						option_tmpfsStatus.xAxis.data.push([hour,minute,second].join(':'));
						option_oracleConnChart.xAxis.data.push([hour,minute,second].join(':'));
						var connections = data[key][i].connections;
						var connectionsActive = data[key][i].connectionsActive;
						option_oracleConnChart.series[0].data.push(connections);
						option_oracleConnChart.series[1].data.push(connectionsActive);
					}
					var ohaStatus = data[key][data[key].length-1].ohaStatus;
					if(ohaStatus.toLocaleLowerCase() == oracleDataBase){
						var position = document.getElementById("server1");
						var serverName = document.createElement('h5');
						var serverstatus = document.createElement('h5');
						serverName.innerHTML='<h5 style="font-weight:bold;">oha运行状态</h5>';
						serverstatus.innerHTML='<h5 id="ohaStatus">'+'状态异常'+'</h5>';
						position.appendChild(serverName);
						position.appendChild(serverstatus);	
						position.setAttribute('style', 'border: 2px solid #121F50 !important;background-color:#FF5151');
						if(serviceStatus.toLocaleLowerCase()!=service){
							var hour = new Date().getHours();
							var minute = new Date().getMinutes();
							var second = new Date().getSeconds();
							prompt([hour,minute,second].join(':')+' &nbsp;oha运行状态异常');
							warnMusic();	
						}
					}else {
						var position = document.getElementById("server1");
						var serverName = document.createElement('h5');
						var serverstatus = document.createElement('h5');
						serverName.innerHTML='<h5 style="font-weight:bold;">oha运行状态</h5>';
						serverstatus.innerHTML='<h5 id="ohaStatus">'+'服务正常'+'</h5>';
						position.appendChild(serverName);
						position.appendChild(serverstatus);	
					}
					var crsStatus = data[key][data[key].length-1].crsStatus;
					if(crsStatus.toLocaleLowerCase() == oracleDataBase){
						var position = document.getElementById("server2");
						var serverName = document.createElement('h5');
						var serverstatus = document.createElement('h5');
						serverName.innerHTML='<h5 style="font-weight:bold;">CRS运行状态</h5>';
						serverstatus.innerHTML='<h5 id="crsStatus">'+'状态异常'+'</h5>';
						position.appendChild(serverName);
						position.appendChild(serverstatus);	
						position.setAttribute('style', 'border: 2px solid #121F50 !important;background-color:#FF5151');
						if(serviceStatus.toLocaleLowerCase()!=service){
							var hour = new Date().getHours();
							var minute = new Date().getMinutes();
							var second = new Date().getSeconds();
							prompt([hour,minute,second].join(':')+'&nbsp; CRS运行状态异常');
							warnMusic();	
						}
					}else {
						var position = document.getElementById("server2");
						var serverName = document.createElement('h5');
						var serverstatus = document.createElement('h5');
						serverName.innerHTML='<h5 style="font-weight:bold;">CRS运行状态</h5>';
						serverstatus.innerHTML='<h5 id="crsStatus">'+'状态正常'+'</h5>';
						position.appendChild(serverName);
						position.appendChild(serverstatus);	
					}
					//css状态
					var cssStatus = data[key][data[key].length-1].cssStatus;
					if(cssStatus.toLocaleLowerCase() == oracleDataBase){
						var position = document.getElementById("server3");
						var serverName = document.createElement('h5');
						var serverstatus = document.createElement('h5');
						serverName.innerHTML='<h5 style="font-weight:bold;">CSS运行状态</h5>';
						serverstatus.innerHTML='<h5 id="cssStatus">'+'状态异常'+'</h5>';
						position.appendChild(serverName);
						position.appendChild(serverstatus);	
						position.setAttribute('style', 'border: 2px solid #121F50 !important;background-color:#FF5151');
						if(serviceStatus.toLocaleLowerCase()!=service){
							var hour = new Date().getHours();
							var minute = new Date().getMinutes();
							var second = new Date().getSeconds();
							prompt([hour,minute,second].join(':')+'&nbsp; CSS运行状态异常');
							warnMusic();	
						}
					}else {
						var position = document.getElementById("server3");
						var serverName = document.createElement('h5');
						var serverstatus = document.createElement('h5');
						serverName.innerHTML='<h5 style="font-weight:bold;">CSS运行状态</h5>';
						serverstatus.innerHTML='<h5 id="cssStatus">'+'服务正常'+'</h5>';
						position.appendChild(serverName);
						position.appendChild(serverstatus);	
					}
					//asm状态
					var asmStatus = data[key][data[key].length-1].asmStatus;
					var asmposition = document.getElementById("server4");
					var asmStatusName = document.createElement('h5');
					var serversasmStatus = document.createElement('h5');
					asmStatusName.innerHTML='<h5 style="font-weight:bold;">ASM运行状态</h5>';
					serversasmStatus.innerHTML='<h5 id="asmStatus">'+'服务正常'+'</h5>';
					asmposition.appendChild(asmStatusName);
					asmposition.appendChild(serversasmStatus);	
					for ( var asmstatusname in asmStatus) {
						for ( var statusname in asmStatus[asmstatusname]) {
							if(asmStatus[asmstatusname][statusname]=='"'+oracleAsm+'"'){
								console.log(oracleAsm);
								document.getElementById("asmStatus").toLocaleLowerCase().innerHTML='状态异常';
								asmposition.setAttribute('style', 'border: 2px solid #121F50 !important;background-color:#FF5151');
								if(serviceStatus.toLocaleLowerCase()!=service){
									prompt([hour,minute,second].join(':')+'&nbsp; '+statusname+'&nbsp;的ASM运行状态异常');
									warnMusic();									
								}
							}
						}
					}
					//磁盘组运行状态
					var diskGroupStatus = data[key][data[key].length-1].diskGroupStatus;
					var diskGroupposition = document.getElementById("server5");
					var diskStatusName = document.createElement('h5');
					var diskserversStatus = document.createElement('h5');
					diskStatusName.innerHTML='<h5 style="font-weight:bold;">磁盘组运行状态</h5>';
					diskserversStatus.innerHTML='<h5 id="diskGroupStatus">'+'服务正常'+'</h5>';
					diskGroupposition.appendChild(diskStatusName);
					diskGroupposition.appendChild(diskserversStatus);
					for ( var diskGroup in diskGroupStatus) {
						for ( var disk in diskGroupStatus[diskGroup]) {
							if (diskGroupStatus[diskGroup][disk].toLocaleLowerCase()=='"'+oracleDiskGrop+'"') {
								document.getElementById("diskGroupStatus").innerHTML='状态异常';
								diskGroupposition.setAttribute('style', 'border: 2px solid #121F50 !important;background-color:#FF5151');
								if(serviceStatus.toLocaleLowerCase()!=service){
									prompt([hour,minute,second].join(':')+'&nbsp; '+diskGroup+'&nbsp;磁盘组&nbsp;'+disk+'&nbsp;的磁盘组运行状态异常');
									warnMusic();	
								}
							}
						}
					}
					//监听运行状态
					var listenStatus = data[key][data[key].length-1].listenStatus;
					var listenGroupposition = document.getElementById("server6");
					var listenStatusName = document.createElement('h5');
					var listenserversStatus = document.createElement('h5');
					listenStatusName.innerHTML='<h5 style="font-weight:bold;">磁盘组运行状态</h5>';
					listenserversStatus.innerHTML='<h5 id="listenStatus">'+'服务正常'+'</h5>';
					listenGroupposition.appendChild(listenStatusName);
					listenGroupposition.appendChild(listenserversStatus);
					for ( var listenGrop in listenStatus) {
						for ( var listen in listenStatus[listenGrop]) {
							if (listenStatus[listenGrop][listen].toLocaleLowerCase().toLocaleLowerCase()=='"'+oracleListen+'"') {
								document.getElementById("listenStatus").innerHTML='状态异常';
								listenGroupposition.setAttribute('style', 'border: 2px solid #121F50 !important;background-color:#FF5151');
								if(serviceStatus.toLocaleLowerCase()!=service){	
									prompt([hour,minute,second].join(':')+'&nbsp; '+listenGrop+'&nbsp;的&nbsp;'+listen+'&nbsp;的监听运行状态异常');
									warnMusic();
								}
							}
							
						}
					}
					//网络IP状态
					var netIpStatus = data[key][data[key].length-1].netIpStatus;
					var netIpGroupposition = document.getElementById("server7");
					var netIpStatusName = document.createElement('h5');
					var netIpserversStatus = document.createElement('h5');
					netIpStatusName.innerHTML='<h5 style="font-weight:bold;">网络IP状态</h5>';
					netIpserversStatus.innerHTML='<h5 id="netIpStatus">'+'服务正常'+'</h5>';
					netIpGroupposition.appendChild(netIpStatusName);
					netIpGroupposition.appendChild(netIpserversStatus);
					for ( var netIpGrop in netIpStatus) {
						for ( var netIp in netIpStatus[netIpGrop]) {
							if (netIpStatus[netIpGrop][netIp].toLocaleLowerCase().toLocaleLowerCase()=='"'+oracleNetVip+'"') {
								document.getElementById("netIpStatus").innerHTML='状态异常';
								listenGroupposition.setAttribute('style', 'border: 2px solid #121F50 !important;background-color:#FF5151');
								if(serviceStatus.toLocaleLowerCase()!=service){	
									prompt([hour,minute,second].join(':')+'&nbsp; '+netIpGrop+'&nbsp;的&nbsp;'+netIp+'&nbsp;的网络IP状态异常');
									warnMusic();
								}
							}
						}
					}
					//实例运行状态
					var instanceStatus = data[key][data[key].length-1].instanceStatus;
					var inposition = document.getElementById("server8");
					var inStatusName = document.createElement('h5');
					var inserversStatus = document.createElement('h5');
					inStatusName.innerHTML='<h5 style="font-weight:bold;">实例运行状态</h5>';
					inserversStatus.innerHTML='<h5 id="instanceStatus">'+'服务正常'+'</h5>';
					inposition.appendChild(inStatusName);
					inposition.appendChild(inserversStatus);	
					for ( var instance in instanceStatus) {
						for ( var instanceDe in instanceStatus[instance]) {
							if(instanceStatus[instance][instanceDe].toLocaleLowerCase()=='"'+oracleInstance+'"'){
								document.getElementById("instanceStatus").innerHTML='状态异常';
								inposition.setAttribute('style', 'border: 2px solid #121F50 !important;background-color:#FF5151');
								if(serviceStatus.toLocaleLowerCase()!=service){
									prompt([hour,minute,second].join(':')+'&nbsp; '+instance+'&nbsp;的实例运行状态异常');
									warnMusic();	
								}
							}
						}
					}
					//端口
					var portStatus = data[key][data[key].length-1].portStatus;
					var portposition = document.getElementById("server9");
					var portStatusName = document.createElement('h5');
					var portserversStatus = document.createElement('h5');
					portStatusName.innerHTML='<h5 style="font-weight:bold;">端口状态</h5>';
					portserversStatus.innerHTML='<h5 id="portStatus">'+'服务正常'+'</h5>';
					portposition.appendChild(portStatusName);
					portposition.appendChild(portserversStatus);	
					for ( var port in portStatus) {			
						if(portStatus[port].toLocaleLowerCase()==portStatusth){
							document.getElementById("portStatus").innerHTML='状态异常';
							portposition.setAttribute('style', 'border: 2px solid #121F50 !important;background-color:#FF5151');
							if(serviceStatus.toLocaleLowerCase()!=service){
								prompt([hour,minute,second].join(':')+'&nbsp; '+key+'&nbsp;端口&nbsp;'+port+'&nbsp;未开启');
								warnMusic();								
							}
						}
					}
				}
			}
			for (var int2 = 0; int2 < data[key].length; int2++) {
				var tmpfsUsedPer = data[key][int2].tmpfsUsedPer;
				if (tmpfsUsedPer>parseInt(oracleTmpfsUsed)) {
					prompt(key+ '&nbsp; 服务器的&nbsp;'+ '&nbsp;tmpfs使用率已达到&nbsp; '+tmpfsUsedPer+'%');
					warnMusic();
				}
				for (var i = 0; i < strs.length; i++) {
					if(strs[i]==key){
						option_tmpfsStatus.series[i].data.push(tmpfsUsedPer);
					}
				}
			}
			m++;
		}
		tmpfsStatusChart.setOption(option_tmpfsStatus);
		oracleConnChart.setOption(option_oracleConnChart);
	});
}
//刷新ORACLE数据
function freshOracleInfo() {
	$.post('OracleInfo/getAllOracleInfo',{ip:strss},function(data){
		var data=data.data;
		var maxTime = data[strs[0]].time;
		for (var int = 1; int < strs.length; int++) {
			var time = data[strs[int]].time.time;
			if(maxTime<time){
				maxTime=time;
			}
		}
		for ( var key in data) {
			if(data[key].time==maxTime){
				var serviesStatus = data[key].status;
				var oracleStatusstr = '服务状态：';
				if(serviesStatus.toLocaleLowerCase()==service){
					oracleStatusstr+='<font color="red">' + serviesStatus + '</font>\t';
					prompt([hour,minute,second].join(':')+' &nbsp;ORACLE服务未开启');
					warnMusic();
				}else {
					oracleStatusstr+='<font color="white">' + serviesStatus + '</font>\t';
				}
				for ( var key1 in data[key].portStatus) {
					if(data[key].portStatus[key1].toLocaleLowerCase()==portStatusth){
						oracleStatusstr+='端口' +key1 + '：'+'<font color="red">' + data[key].portStatus[key1] + '</font>\t';
					}else {
						oracleStatusstr+='端口' +key1 + '：'+'<font color="white">' + data[key].portStatus[key1] + '</font>\t';
					}
				}
				serverAndPort.innerHTML=oracleStatusstr;

					var time = data[key].time;
					var hour = new Date(time*1000).getHours();
					if(hour < 10){
						hour='0'+hour;
					}
					var minute = new Date(time*1000).getMinutes();
					if(minute < 10){
						minute='0'+minute;
					}
					var second = new Date(time*1000).getSeconds();
					if(second < 10){
						second='0'+second;
					}
					var connections = data[key].connections;
					var connectionsActive = data[key].connectionsActive;
					if(option_oracleConnChart.series[0].data.length<20){
						option_tmpfsStatus.xAxis.data.push([hour,minute,second].join(':'));
						option_oracleConnChart.xAxis.data.push([hour,minute,second].join(':'));
						option_oracleConnChart.series[0].data.push(connections);
						option_oracleConnChart.series[1].data.push(connectionsActive);
					}else {
						option_tmpfsStatus.xAxis.data.shift();
						option_tmpfsStatus.xAxis.data.push([hour,minute,second].join(':'));
						option_oracleConnChart.xAxis.data.shift();
						option_oracleConnChart.xAxis.data.push([hour,minute,second].join(':'));
						option_oracleConnChart.series[0].data.shift();
						option_oracleConnChart.series[0].data.push(connections);
						option_oracleConnChart.series[1].data.shift();
						option_oracleConnChart.series[1].data.push(connectionsActive);
					}

				//oha运行状态
				var ohaStatus = data[key].ohaStatus;
				if(ohaStatus.toLocaleLowerCase() == oracleDataBase){
					var position = document.getElementById("server1");
					document.getElementById("ohaStatus").innerHTML='状态异常';
					position.setAttribute('style', 'border: 2px solid #121F50 !important;background-color:#FF5151');
					var hour = new Date().getHours();
					var minute = new Date().getMinutes();
					var second = new Date().getSeconds();
					if (serviesStatus.toLocaleLowerCase()!=service) {
						prompt([hour,minute,second].join(':')+'&nbsp; oha运行状态异常');
						warnMusic();						
					}
				}
				//crs运行状态
				var crsStatus = data[key].crsStatus;
				if(crsStatus.toLocaleLowerCase() == oracleDataBase){
					var position = document.getElementById("server2");
					document.getElementById("crsStatus").innerHTML='状态异常';
					position.setAttribute('style', 'border: 2px solid #121F50 !important;background-color:#FF5151');
					var hour = new Date().getHours();
					var minute = new Date().getMinutes();
					var second = new Date().getSeconds();
					if (serviesStatus.toLocaleLowerCase()!=service) {
						prompt([hour,minute,second].join(':')+'&nbsp; crs运行状态异常');
						warnMusic();	
					}
				}
				//css状态
				var cssStatus = data[key].cssStatus;
				if(cssStatus.toLocaleLowerCase() == oracleCrs){
					var position = document.getElementById("server3");
					document.getElementById("cssStatus").innerHTML='状态异常';
					position.setAttribute('style', 'border: 2px solid #121F50 !important;background-color:#FF5151');
					var hour = new Date().getHours();
					var minute = new Date().getMinutes();
					var second = new Date().getSeconds();
					if (serviesStatus.toLocaleLowerCase()!=service) {			
						prompt([hour,minute,second].join(':')+' &nbsp;css运行状态异常');
						warnMusic();
					}
				}
				//asm状态
				var asmStatus = data[key].asmStatus;
				var asmposition = document.getElementById("server4");
				for ( var asmstatusname in asmStatus) {
					for ( var statusname in asmStatus[asmstatusname]) {
						if(asmStatus[asmstatusname][statusname].toLocaleLowerCase() == '"'+oracleAsm+'"'){
							document.getElementById("asmStatus").innerHTML='状态异常';
							asmposition.setAttribute('style', 'border: 2px solid #121F50 !important;background-color:#FF5151');
							if (serviesStatus.toLocaleLowerCase()!=service) {								
								prompt([hour,minute,second].join(':')+'&nbsp; '+statusname+'&nbsp;的ASM运行状态异常');
								warnMusic();
							}
						}
					}
				}
				//磁盘组运行状态
				var diskGroupStatus = data[key].diskGroupStatus;
				var diskGroupposition = document.getElementById("server5");
				for ( var diskGroup in diskGroupStatus) {
					for ( var disk in diskGroupStatus[diskGroup]) {
						if (diskGroupStatus[diskGroup][disk].toLocaleLowerCase()=='"'+oracleDiskGrop+'"') {
							document.getElementById("diskGroupStatus").innerHTML='状态异常';
							diskGroupposition.setAttribute('style', 'border: 2px solid #121F50 !important;background-color:#FF5151');
							if (serviesStatus.toLocaleLowerCase()!=service) {								
								prompt([hour,minute,second].join(':')+'&nbsp; '+diskGroup+'&nbsp;磁盘组&nbsp;'+disk+'&nbsp;的磁盘组运行状态异常');
								warnMusic();
							}
						}
					}
				}
				//监听运行状态
				var listenStatus = data[key].listenStatus;
				var listenGroupposition = document.getElementById("server6");
				for ( var listenGrop in listenStatus) {
					for ( var listen in listenStatus[listenGrop]) {
						if (listenStatus[listenGrop][listen].toLocaleLowerCase()=='"'+oracleListen+'"') {
							document.getElementById("listenStatus").innerHTML='状态异常';
							listenGroupposition.setAttribute('style', 'border: 2px solid #121F50 !important;background-color:#FF5151');
							if (serviesStatus.toLocaleLowerCase()!=service) {								
								prompt([hour,minute,second].join(':')+' &nbsp;'+listenGrop+'&nbsp;的&nbsp;'+listen+'&nbsp;的监听运行状态异常');
								warnMusic();
							}
						}
						
					}
				}
				//网络IP状态
				var netIpStatus = data[key].netIpStatus;
				var netIpGroupposition = document.getElementById("server7");
				for ( var netIpGrop in netIpStatus) {
					for ( var netIp in netIpStatus[netIpGrop]) {
						if (netIpStatus[netIpGrop][netIp].toLocaleLowerCase()=='"'+oracleNetVip+'"') {
							document.getElementById("netIpStatus").innerHTML='状态异常';
							listenGroupposition.setAttribute('style', 'border: 2px solid #121F50 !important;background-color:#FF5151');
							if (serviesStatus.toLocaleLowerCase()!=service) {								
								prompt([hour,minute,second].join(':')+'&nbsp; '+netIpGrop+'&nbsp;的&nbsp;'+netIp+'&nbsp;的网络IP状态异常');
								warnMusic();
							}
						}
						
					}
				}
				//实例运行状态
				var instanceStatus = data[key].instanceStatus;
				var inposition = document.getElementById("server8");	
				for ( var instance in instanceStatus) {		
					for ( var instanceDe in instanceStatus[instance]) {
						if(instanceStatus[instance][instanceDe].toLocaleLowerCase()=='"'+oracleInstance+'"'){
							document.getElementById("instanceStatus").innerHTML='状态异常';
							inposition.setAttribute('style', 'border: 2px solid #121F50 !important;background-color:#FF5151');
							if (serviesStatus.toLocaleLowerCase()!=service) {
								prompt([hour,minute,second].join(':')+'&nbsp; '+instance+'&nbsp;的实例运行状态异常');
								warnMusic();								
							}
						}
					}
				}
				//端口
				var portStatus = data[key].portStatus;
				var portposition = document.getElementById("server9");	
				for ( var port in portStatus) {			
					if(portStatus[port].toLocaleLowerCase()==portStatusth){
						document.getElementById("portStatus").innerHTML='状态异常';
						portposition.setAttribute('style', 'border: 2px solid #121F50 !important;background-color:#FF5151');
						if (serviesStatus.toLocaleLowerCase()!=service) {
							prompt([hour,minute,second].join(':')+'&nbsp; '+key+'&nbsp;端口&nbsp;'+port+'&nbsp;未开启');
							warnMusic();							
						}
					}
				}
			}
		}
		var tmpfsUsedPer = data[key].tmpfsUsedPer;
		if (tmpfsUsedPer>parseInt(oracleTmpfsUsed)) {
			prompt(key+ '&nbsp;服务器的'+ 'tmpfs使用率已达到&nbsp;'+tmpfsUsedPer+'%');
			warnMusic();
		}
		for (var i = 0; i < strs.length; i++) {
			if(strs[i]==key){
				if (option_tmpfsStatus.series[i].data.length<20) {
					option_tmpfsStatus.series[i].data.push(tmpfsUsedPer);	
				}else {
					option_tmpfsStatus.series[i].data.shift();
					option_tmpfsStatus.series[i].data.push(tmpfsUsedPer);
				}
			}
		}
		tmpfsStatusChart.setOption(option_tmpfsStatus);
		oracleConnChart.setOption(option_oracleConnChart);
	});
}
function getTable(name) {
	var table = '<table class="table table-bordered" style="width=476px;height=240px;margin-top:-5%; color: #6C6C6C;"><tr><td id="server1" width="119px" height="69px" bgcolor="#56D1FD" style="border: 2px solid #121F50 !important; "></td><td id="server2" width="119px" height="69px" bgcolor="#56D1FD" style="border: 2px solid #121F50 !important; "></td><td id="server3" width="119px" height="69px" bgcolor="#56D1FD" style="border: 2px solid #121F50 !important; "></td></tr>'
				+'<tr><td id="server4" width="119px" height="69px" bgcolor="#56D1FD" style="border: 2px solid #121F50 !important; "></td><td id="server5" width="119px" height="69px" bgcolor="#56D1FD" style="border: 2px solid #121F50 !important; "></td><td id="server6" width="119px" height="69px" bgcolor="#56D1FD" style="border: 2px solid #121F50 !important; "></td></tr>'
				+'<tr><td id="server7" width="119px" height="69px" bgcolor="#56D1FD" style="border: 2px solid #121F50 !important; "></td><td id="server8" width="119px" height="69px" bgcolor="#56D1FD" style="border: 2px solid #121F50 !important; "></td><td id="server9" width="119px" height="69px" bgcolor="#56D1FD" style="border: 2px solid #121F50 !important; "></td></tr>'
				+'</table>';
	name.innerHTML = table;
}
function getTableCanvas(name, position) {
	var canvas = document.createElement('div');
	canvas.innerHTML = '<div></div>';
	canvas.setAttribute('id', name);
	canvas.setAttribute('style', 'height:86%;margin-top: 7%');
	position.appendChild(canvas);
}
//得到echarts画布
function getCanvas(name, position) {
	var canvas = document.createElement('div');
	canvas.innerHTML = '<div></div>';
	canvas.setAttribute('id', name);
	canvas.setAttribute('style', 'height:95%;margin-top: -4%');
	position.appendChild(canvas);
}
//得到jtopo画布
function getORacleStatusCanvas(name, position) {
	var canvas = document.createElement('div');
	canvas.innerHTML = '<div></div>';
	canvas.setAttribute('id', name);
	canvas.setAttribute('class', 'text-center');
	canvas.setAttribute('style', 'height:10%;margin-top: -10%');
	position.appendChild(canvas);
}
//页面响铃报警
function warnMusic() {
	var music = document.getElementById('warnMusic');
	music.play();
	var times = 0;
	var interval = setInterval(function() {
		times += 1;
		if (times == 8) {
			clearInterval(interval);
			music.pause();
		}
	}, 1000)
}
//页面提示框报警
function prompt(status) {
	toastr.options = {
		closeButton : true,
		progressBar : true,
		showMethod : 'slideDown',
		timeOut : 30000
	};
	toastr.warning(status);
}
var portInfo = document.createElement('div');
style='width:800px;height:250px;position: absolute;top:0px;left:0px;z-index:9999;display:none';
portInfo.setAttribute('style', style);
portInfo.setAttribute('id', 'portInfo');
var pStatus = '<div class="col-sm-2"><a class="abutton" href="ServerInfo/getNewServerinfo?code=TCMEMR"><img src="image/01.png" width="80" height="80"><br><br><font size="4" style="font-weight: bold;position:relative;top:-20px;" color="#EEE">电子病历</font></a></div>' +
'<div class="col-sm-2"><a class="abutton" href="ServerInfo/getNewServerinfo?code=TCMAE"><img src="image/02.png" width="80" height="80"><br><br><font size="4" style="font-weight: bold;position:relative;top:-20px;" color="#EEE">辨证论治</font></a></div>'+
'<div class="col-sm-2"><a class="abutton" href="ServerInfo/getNewServerinfo?code=TCMK"><img src="image/03.png" width="80" height="80"><br><br><font size="4" style="font-weight: bold;position:relative;top:-20px;" color="#EEE">知识库</font></a></div>'+
'<div class="col-sm-2"><a class="abutton" href="ServerInfo/getNewServerinfo?code=TCMRC"><img src="image/04.png" width="80" height="80"><br><br><font size="4" style="font-weight: bold;position:relative;top:-20px;" color="#EEE">远程会诊</font></a></div>'+
'<div class="col-sm-2"><a class="abutton" href="ServerInfo/getNewServerinfo?code=TCMRT"><img src="image/05.png" width="80" height="80"><br><br><font size="4" style="font-weight: bold;position:relative;top:-20px;" color="#EEE">远程教育</font></a></div>'+
'<div class="col-sm-2"><a class="abutton" href="ServerInfo/getNewServerinfo?code=TCMHEAL"><img src="image/06.png" width="80" height="80"><br><br><font size="4" style="font-weight: bold;position:relative;top:-20px;" color="#EEE">治未病</font></a></div>'+
'<div class="col-sm-2"><a class="abutton" href="ServerInfo/getNewServerinfo?code=TCMCBS"><img src="image/07.png" width="80" height="80"><br><br><font size="4" style="font-weight: bold;position:relative;top:-20px;" color="#EEE">业务监管</font></a></div>'+
'<div class="col-sm-2"><a class="abutton" href="ServerInfo/getNewServerinfo?code=TCMPMS"><img src="image/08.png" width="80" height="80"><br><br><font size="4" style="font-weight: bold;position:relative;top:-20px;" color="#EEE">资源配置</font></a></div>'+
'<div class="col-sm-2"><a class="abutton" href="ServerInfo/getNewServerinfo?code=TCMESB"><img src="image/09.png" width="80" height="80"><br><br><font size="4" style="font-weight: bold;position:relative;top:-20px;" color="#EEE">ESB系统</font></a></div>'+
'<div class="col-sm-2"><a class="abutton" href="ServerInfo/getNewServerinfo?code=MYSQL"><img src="image/10.png" width="80" height="80"><br><br><font size="4" style="font-weight: bold;position:relative;top:-20px;" color="#EEE">MYSQL</font></a></div>'+
'<div class="col-sm-2"><a class="abutton" href="ServerInfo/getNewServerinfo?code=NGINX"><img src="image/11.png" width="80" height="80"><br><br><font size="4" style="font-weight: bold;position:relative;top:-20px;" color="#EEE">负载均衡</font></a></div>'+
'<div class="col-sm-2"><a class="abutton" href="ServerInfo/getNewServerinfo?code=TCMEMR"><img src="image/12.png" width="80" height="80"><br><br><font size="4" style="font-weight: bold;position:relative;top:-20px;" color="#EEE">互联互通</font></a></div>';
portInfo.innerHTML=pStatus;
center_2.appendChild(portInfo);


var portInfo2 = document.createElement('button');
style='width:50px;height:20px;position: absolute;top:280px;left:370px;z-index:9999;color:#000';
portInfo2.setAttribute('style', style);
portInfo2.setAttribute('id', 'portInfo2');
portInfo2.setAttribute('onclick', 'gotos()');
portInfo2.innerHTML = '点我'
center_2.appendChild(portInfo2);

var flag = true;
function gotos(){
	if(flag){
		document.getElementById("tableUser").style.display='none';
		portInfo.style.display='block';
		document.getElementById("oracleTable").innerHTML='';
		flag = false;
	}else{
		portInfo.style.display='none';
		document.getElementById("tableUser").style.display='block';
		document.getElementById("oracleTable").innerHTML='ORACLE表空间使用率';
		flag = true;
	}
	
}

